package com.excellence.service.impl;

import com.excellence.mapper.CollectionMapper;
import com.excellence.pojo.Collection;
import com.excellence.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author 沈秉璋
 * @ClassName CollectionServiceImpl
 * @Description TODO
 * @date 2024/4/8 10:49
 * @Version 1.0
 */
@Service
public class CollectionServiceImpl implements CollectionService {
    @Autowired
    CollectionMapper collectionMapper;
    @Override
    public int deleteByPrimaryKey(Long id) {
        return collectionMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Collection record) {
        record.setCreateTime(new Date());
        return collectionMapper.insert(record);
    }

    @Override
    public int insertSelective(Collection record) {
        record.setCreateTime(new Date());
        return collectionMapper.insertSelective(record);
    }

    @Override
    public Collection selectByPrimaryKey(Long id) {
        return collectionMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Collection> selectAll() {
        return collectionMapper.selectAll();
    }

    @Override
    public int updateByPrimaryKeySelective(Collection record) {
        record.setCreateTime(new Date());
        return collectionMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Collection record) {
        record.setCreateTime(new Date());
        return collectionMapper.updateByPrimaryKey(record);
    }
}
